# coding=utf-8
import arcpy

path = r'D:\Test';
arcpy.env.workspace = path
shp = r'D:\Test\YA_RIV_LEVEL6_4326_1.shp'.decode('utf-8')
cs1 = arcpy.da.SearchCursor(shp,['SHAPE@','name','level','flowRiv','flowId','lpDisRiv'])

shp2 = r'D:\Test\YA_RIV_LEVEL6_4326_2.shp'.decode('utf-8')
# cs2 = arcpy.da.SearchCursor(shp2,['SHAPE@','name','level'])
i=0
for row1 in cs1:
    rivName = row1[1]
    rivLevel = row1[2]
    nextRivId = row1[4]
    expression = 'rivId = {}'.format(nextRivId)
    cs2 = arcpy.da.SearchCursor(shp2, ['SHAPE@', 'name', 'level'],where_clause=expression)
    for row2 in cs2:
        if(int(rivLevel) - int(row2[2]) != 1):
            print i,rivName, rivLevel, row2[1], row2[2],"lev-sub:%d"%(int(row2[2])-int(rivLevel))
    cs2.reset()
    i+=1
